#include "../common/irobot_abstract2.h"
#include "../common/oi.h"

int main(int argc, char **argv) {
	ir_initialize(0);
	ir_sleep(100);
	
	ir_send_byte(CmdStart);
	ir_send_byte(CmdFull);

/// light the leds--idiot test
	ir_sleep(100);
	ir_send_byte(CmdLeds);
	ir_send_byte(0);
	ir_send_byte(0);
	ir_send_byte(255);



	while(1){
		collect_sensor_data();
	if(infrared() == 242){
		ir_send_byte(CmdLeds);
		ir_send_byte(0);
		ir_send_byte(0);
		ir_send_byte(255);
	}
	else if(infrared() == 248){ //red
		ir_send_byte(CmdLeds);
		ir_send_byte(LEDAdvance); // advance
		ir_send_byte(0);
		ir_send_byte(0);
	}
	else if(infrared() == 244){ //green
		ir_send_byte(CmdLeds);
		ir_send_byte(LEDPlay); // play
		ir_send_byte(0);
		ir_send_byte(0);
	}
	else if(infrared() == 252){ // red&green
		ir_send_byte(CmdLeds);
		ir_send_byte(LEDsBoth); // play && advance 
		ir_send_byte(0);
		ir_send_byte(0);
	}
	else if(infrared() == 250){ // red&force
		ir_send_byte(CmdLeds);
		ir_send_byte(LEDAdvance); // advance
		ir_send_byte(0);
		ir_send_byte(255);
	}
	else if(infrared() == 246){ // green&force
		ir_send_byte(CmdLeds);
		ir_send_byte(LEDPlay); // play
		ir_send_byte(0);
		ir_send_byte(255);
	}
	else if(infrared() == 254){ // all
		ir_send_byte(CmdLeds);
		ir_send_byte(LEDsBoth); // play && advance 
		ir_send_byte(0);
		ir_send_byte(255);
	}
	else{
		ir_send_byte(CmdLeds);
		ir_send_byte(0); // play && advance 
		ir_send_byte(0);
		ir_send_byte(0);
	}

	}
}
